<?php 
header("Content-type:text/html;charset=utf-8");
function getSuffix($filename)
{
	$start = strpos($filename,".");//取文件名点的位置
	$len = strlen($filename)-$start-1;
	return substr($filename,$start+1,$len);//三个参数，文件名，截取位置，截取的长度
}
//getSuffix("abc.txt");

/*$s=strrchr("bcd.doc",'.');
echo $s;
*/
function isPicture($filename)
{   
	$allowtype = array("jpg","jpeg","png","gif","Bmp","flv");
	$suffix= getSuffix($filename);
     for($i=0;$i<count($allowtype);$i++)
     	if($suffix=$allowtype[$i])
     	return true;

     return false;	
}
if(isPicture("bcd.jpg")==true)
	echo "成功";
else
	echo "失败";



?>